package com.example.service.impl;

import com.example.entity.Jiesuan;
import com.example.mapper.JiesuanMapper;
import com.example.service.IJiesuanService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JiesuanServiceImpl implements IJiesuanService {
    @Autowired
    private JiesuanMapper jiesuanMapper;

    @Override
    public PageInfo<Jiesuan> findAll(String name, Integer typeId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);

        List<Jiesuan> list = jiesuanMapper.findAll(name,typeId);

        PageInfo<Jiesuan> pageInfo = new PageInfo<>(list);

        return pageInfo;
    }

    @Override
    public void delete(Integer id) {
        jiesuanMapper.delete(id);
    }

    @Override
    public Jiesuan getById(Integer id) {
        return jiesuanMapper.getById(id);
    }

    @Override
    public void update(Jiesuan jiesuan) {
        jiesuanMapper.update(jiesuan);
    }
}
